package com.meizhuo.listview.api;


import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;


public class HttpClient<T> {

    private static HttpClient httpClient ;

    private   Retrofit retrofit = new Retrofit.Builder() //设置网络请求的Url地址
            .baseUrl("http://10.0.2.2:7000")
            .addConverterFactory(GsonConverterFactory.create()).build();

     public void start(Call<T> call ,Callback<T> callback){

         call.enqueue(callback);
     }

    public Retrofit getHttpClient(){
         return retrofit;
     }

     public static HttpClient getInstance(){

        if(httpClient == null){
            httpClient = new HttpClient();
        }
            return httpClient ;

    }
}
